package sdau.hjk.service.Impl;

import org.junit.Test;
import sdau.hjk.dao.IUserDao;
import sdau.hjk.entity.User;
import sdau.hjk.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *@version 1.0
 *@author: huangjiakai
 *@create:2021−02-05 16:41
 *@className:com.hjk.service.UserService
 *@description: TODO
 */
@Service("userService")
public class UserService implements IUserService {
    @Autowired
    private IUserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public void saveUser(User user) {
        userDao.saveUser(user);
        userDao.saveUserInfo(user);
    }

    @Override
    public User findByOpenid(String openid){
        return userDao.findByOpenid(openid);
    }

    @Override
    public List<User> findByGrade(String major,String grade) {
        return userDao.findByGrade(major,grade);
    }

    @Override
    public List<User> findByMajor(String major) {
        return userDao.findByMajor(major);
    }

    @Override
    public User findById(Integer id) {
        return userDao.findById(id);
    }

}
